package me.fanwu.utils;

import org.joda.time.DateTime;

import java.util.Date;

/*
 * Wupher 编写于 16/8/9.
 */
public class DateUtils {
    private DateUtils() {

    }

    public static Integer minutesOfDay(Date date) {
        DateTime dt = new DateTime(date);
        return dt.getMinuteOfDay();
    }

    public static Date mod2Date(int minutesOfDay) {
        DateTime dateTime = new DateTime();
        dateTime = dateTime.plusMinutes(minutesOfDay);
        return dateTime.toDate();
    }

    public static String mod2Str(int minutesOfDay) {
        DateTime dt = new DateTime();
        dt = dt.plusMinutes(minutesOfDay);
        return dt.hourOfDay().getAsShortText() + ":" + dt.minuteOfHour().getAsShortText();
    }
}
